package com.qf.day07.work;

import java.util.Random;

public class Soldier extends Hero{
    private int rage; //怒气值

    public int getRage() {
        return rage;
    }

    public void setRage(int rage) {
        this.rage = rage;
    }

    public Soldier() {
    }

    public Soldier(String name, int power, int intellect, int fast, int rage) {
        super(name, power, intellect, fast);
        this.rage = rage;
    }

    @Override
    public String toString() {
        return "Soldier{" +
                "rage=" + rage +
                "} " + super.toString();
    }

    public int strike() {
        Random random = new Random();
        int attackUp,attackDown;
        super.getPower();
        attackUp = (int) ( super.getPower() +  super.getPower()*0.2)*2;
        attackDown = (int) ( super.getPower()*0.8)*2;
        this.setRage(this.getRage()-20);
        return attackDown + random.nextInt(attackUp - attackDown)+1;
    }



}
